// JavaScript Document

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 //Commented to accept multiple emails.
		 //if (str.indexOf(at,(lat+1))!=-1){
		 //   alert("Invalid E-mail ID")
		 //   return false
		 //}

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true
	}




function chkRegisterForm()
{
	//if(doValidate())
	//{
		//alert("Please select atleast one user type!");
		//return false;
	//}
	
	if(document.reg.name.value == "" )
	{
		alert("Please enter your name!");
		document.reg.name.focus();
		return false;
	}
	if(document.reg.surname.value == "" )
	{
		alert("Please enter your Surname!");
		document.reg.surname.focus();
		return false;
	}
	if(document.reg.father_name.value == "" )
	{
		alert("Please enter your Father Name!");
		document.reg.father_name.focus();
		return false;
	}
	if(document.reg.father_info.value.length < 30)
	{
		alert("Father information should be atleast 30 characters!");
		document.reg.father_info.focus();
		return false;
	}
	if(document.reg.address.value.length < 20)
	{
		alert("Address should be atleast 20 characters!");
		document.reg.address.focus();
		return false;
	}
	if(document.reg.Date_of_Birth.value == "" )
	{
		alert("Please enter your birth date!");
		document.reg.Date_of_Birth.focus();
		return false;
	}
	if(document.reg.email.value == "" )
	{
		alert("Please enter your email address!");
		document.reg.email.focus();
		return false;
	}
	if(!echeck(document.reg.email.value))
	{
		document.reg.email.focus();
		return false;
	}
	if(document.reg.password1.value == "" )
	{
		alert("Please enter your password!");
		document.reg.password1.focus();
		return false;
	}
	if(document.reg.password1.value.length < 6)
	{
		alert("Password length should be atleast 6 characters!");
		document.reg.password1.focus();
		return false;
	}
	if(document.reg.tel.value == "" )
	{
		alert("Please enter your Telephone!");
		document.reg.tel.focus();
		return false;
	}
	if(document.reg.income.value == "" )
	{
		alert("Please enter your Income!");
		document.reg.income.focus();
		return false;
	}
	if(document.reg.marital_status.value == "" )
	{
		alert("Please Select your Marital Status!");
		document.reg.marital_status.focus();
		return false;
	}
	if(document.reg.aboutfamily.value.length < 50)
	{
		alert("About Family should be atleast 50 characters!");
		document.reg.aboutfamily.focus();
		return false;
	}
	if(document.reg.expectation.value.length < 50)
	{
		alert("Expectation length should be atleast 50 characters!");
		document.reg.expectation.focus();
		return false;
	}
	
	
	//if(document.reg.Address.value.length < 6 )
	//{
		//alert("Address length should be minimum 6 characters!");
		//document.reg.Address.focus();
		//return false;
	//}
	
	
	
		//if(document.reg.friend_email.value == "" )
		//{
		//	alert("Please enter your friend's email address!");
		//	document.reg.friend_email.focus();
		//	return false;
		//}
		//if(!echeck(document.reg.friend_email.value))
		//{
		//	document.reg.friend_email.focus();
		//	return false;
		//}

	return true;
}

<!--
// Validation for non empty fields and correct input values
function chklogin()
{
	if(document.login.username.value == "" )
	{
		alert("Please enter your email address!");
		document.login.username.focus();
		return false;
	}
	if(!echeck(document.login.username.value))
	{
		document.login.username.focus();
		return false;
	}

	if(document.login.password.value=="")
	{
		alert("Please enter your password!");
		document.login.password.focus();
		return false;
	}

	if(document.login.password.value.length < 6)
	{
		alert("Password length should be minimum 6 characters!");
		document.login.password.focus();
		return false;
	}

return true;
}
//-->
function modiPass()
{

if(document.ckpass.password.value=="")
	{
		alert("Please enter your Old password!");
		document.ckpass.password.focus();
		return false;
	}

	if(document.ckpass.password.value.length < 6)
	{
		alert("Password length should be minimum 6 characters!");
		document.ckpass.password.focus();
		return false;
	}
if(document.ckpass.new_pass.value=="")
	{
		alert("Please enter your New password!");
		document.ckpass.new_pass.focus();
		return false;
	}

	if(document.ckpass.new_pass.value.length < 6)
	{
		alert("New Password length should be minimum 6 characters!");
		document.ckpass.new_pass.focus();
		return false;
	}	
if(document.ckpass.new_pass1.value=="")
	{
		alert("Please enter your new password!");
		document.ckpass.new_pass1.focus();
		return false;
	}

	if(document.ckpass.new_pass1.value.length < 6)
	{
		alert("New Password length should be minimum 6 characters!");
		document.ckpass.new_pass1.focus();
		return false;
	}	
return true;	
	
}
function validateRequest()
{
	with(document.frmRequest)
	{
		if(name.value.length < 1){
		alert("Please enter your name!");
		name.focus();
		return false;
		}
		if(email.value == "" )
		{
		alert("Please enter your email address!");
		email.focus();
		return false;
		}
		if(!echeck(email.value))
		{
		email.focus();
		return false;
		}
		//if(company_name.value.length < 1){
		//alert("Please enter your company name!");
		//company_name.focus();
		//return false;
		//}
		if(city.value.length < 1){
		alert("Please enter your city!");
		city.focus();
		return false;
		}
		//if(telephone_number.value.length < 1){
		//alert("Please enter your telephone number!");
		//telephone_number.focus();
		//return false;
		//}
		if(feedback.value.length < 1){
		alert("Please enter your feedback!");
		feedback.focus();
		return false;
		}
	}
	return true;
}

function chkqck()
{
	if(document.quickreg.name.value == "" )
	{
		alert("Please enter your name!");
		document.quickreg.name.focus();
		return false;
	}
	if(document.quickreg.tel.value == "" )
	{
		alert("Please enter Telephone No.");
		document.quickreg.tel.focus();
		return false;
	}
	if(document.quickreg.address.value == "" )
	{
		alert("Please enter your Address!");
		document.quickreg.address.focus();
		return false;
	}
	if(document.quickreg.email.value == "" )
	{
		alert("Please enter your email Address!");
		document.quickreg.email.focus();
		return false;
	}
	if(!echeck(document.quickreg.email.value))
	{
		document.quickreg.email.focus();
		return false;
	}
	if(document.quickreg.password1.value == "" )
	{
		alert("Please enter your Password");
		document.password1.email.focus();
		return false;
	}
	if(document.quickreg.Date_of_Birth.value == "" )
	{
		alert("Please Select your Date of Birth");
		document.quickreg.Date_of_Birth.focus();
		return false;
	}
	if(document.quickreg.aboutfamily.value == "" )
	{
		alert("Please enter your email Address!");
		document.quickreg.aboutfamily.focus();
		return false;
	}
	if(document.quickreg.expectation.value == "" )
	{
		alert("Please enter your Partner Expectation");
		document.quickreg.expectation.focus();
		return false;
	}
	
	

return true;
}
	
function popup(url,width,height,left,top,name){
		var props = "toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,titlebar=no,menubar=no,left="+left+",top="+top+",width="+width+",height="+height;
		w = window.open(url, name, props);
		if (w) {
		w.focus();
		}
}
